// 2013-9-12上午02:25:11  net.betou.trade.main.manager.agencyorproxy.AdminMng.java

package net.betou.trade.main.manager.agencyorproxy;

import java.util.List;
import java.util.Map;

import net.betou.common.page.Pagination;
import net.betou.common.security.exception.BadCredentialsException;
import net.betou.common.security.exception.UsernameNotFoundException;
import net.betou.trade.entity.main.AgentAndAdmins;
import net.betou.trade.entity.main.AgentAndAdminsExt;

/**
 * 
 * @author 叶装装
 */
public interface AdminMng{

	public Pagination getPage( AgentAndAdmins admin, String searchProperty, String searchValue, String orderProperty, String orderDirection, int pageNo, int pageSize, String filterStatus );
	
	/**
	 * 根据ID查找
	 * @param id
	 * @return
	 */
	public AgentAndAdmins findById( Integer id );
	
	/**
	 * 根据用户名查找
	 * @param username
	 * @return
	 */
	public AgentAndAdmins findByUsername( String username );
	
	/**
	 * 查找自己的
	 * @param admin
	 * @param id
	 * @return
	 */
	public AgentAndAdmins findAdmin( AgentAndAdmins admin, Integer id );
	
	/**
	 * 查找管理员
	 * @param id
	 * @return
	 */
	public AgentAndAdmins findAdmin( Integer id );
	
	/**
	 * 更新
	 * @param disabled
	 * @param password
	 * @param email
	 * @param mobile
	 * @param bean
	 * @param ext
	 * @param roleIds
	 * @return
	 */
	public AgentAndAdmins update( Boolean disabled, String password, String email, String mobile, AgentAndAdmins bean, AgentAndAdminsExt ext, Integer [] roleIds );
	
	/**
	 * 保存
	 * @param currentAdmin
	 * @param ip
	 * @param roleIds
	 * @param bean
	 * @param ext
	 * @return
	 */
	public AgentAndAdmins save( AgentAndAdmins currentAdmin, String ip, Integer [ ] roleIds, AgentAndAdmins bean, AgentAndAdminsExt ext );
	
	/**
	 * 删除
	 * @param ids
	 * @return
	 */
	public AgentAndAdmins [ ] deleteByIds( Integer [ ] ids );
	
	/**
	 * 登录
	 * 
	 * @param username
	 * @param password
	 * @param ip
	 * @return
	 * @throws UsernameNotFoundException
	 * @throws BadCredentialsException
	 */
	public AgentAndAdmins login( String username, String password, String ip ) throws UsernameNotFoundException, BadCredentialsException;
	
	/**
	 * 用户名是否存在
	 * 
	 * @param username
	 * @return
	 */
	public boolean userNameNotExist( String username );

	/**
	 * email 是否存在
	 * 
	 * @param email
	 * @return
	 */
	public boolean emailNotExist( String email );

	/**
	 * 手机号码是否存在
	 * 
	 * @param mobile
	 * @return
	 */
	public boolean mobileNotExist( String mobile );

	/**
	 * 居间商名称是否存在
	 * 
	 * @paramname
	 * @return
	 */
	public boolean nameNotExist( String name );
	
	public List< Map< String, String > > findListByUserName( AgentAndAdmins admin, String username );
	
}
